import request from '@/router/axios';

export const getList = (page, size, params) => {
  return request({
    url: '/base/store/listStoreManage',
    method: 'post',
    params: {
      ...params,
      page,
      size,
    }
  })
}
export const remove = (id) => {
  return request({
    url: '/base/store/delete',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: {
      id,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/base/store/add',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/base/store/saveStoreRegisterParam',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: row
  })
}

export const changeStatus = (userId, status) => {
  return request({
    url: '/base/store/changeStatus',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: {
      userId,
      status
    }
  })
}
export const getStoreDetail = (storeId) => {
  return request({
    url: '/base/store/editStoreManage',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: {
      storeId
    }
  })
}
export const getStoreBanner = (storeId) => {
  return request({
    url: '/cms/pageInfo/getStoreBanner',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: {
      storeId
    }
  })
}
export const getParentAndGrandInfoById = (areaId) => {
  return request({
    url: '/base/area/getParentAndGrandInfoById',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: {
      areaId
    }
  })
}

export const getParentInfoById = (areaId) => {
  return request({
    url: '/base/area/getParentInfoById',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: {
      areaId
    }
  })
}

//新增用户
export const adminAddUser = (data) => {
  return request({
    url: '/api/mgr/adminAdd',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: data
  })
}

export const adminAddStore = (row) => {
  return request({
    url: '/base/store/adminRegisterStore',
    meta: {
      isSerialize: true,
    },
    method: 'post',
    data: row
  })
}

//获取商品分类树
export const getClassTree = () => {
  return request({
    url: "/base/goodsClass/listTree",
    method: "post",
  });
};
//获取区域list
export const getListTree= () => {
  return request({
    url: "/base/organization/listTreeByUserOrganization",
    method: "post",
	meta: {
		isSerialize: true,
	},
	data:{
	}
  });
};
//通过商品分类ids获取树形结构
export const getGoodsClassTreeNodesByIds= (ids) => {
  return request({
    url: "/base/goodsClass/getGoodsClassTreeNodesByIds",
    method: "post",
	meta: {
		isSerialize: true,
	},
	data:{
		ids
	}
  });
};
//获取分类以键值对格式返回
export const getMapAllGoodsClass= (data) => {
  return request({
    url: "/base/goodsClass/getMapAllGoodsClass",
    method: "post",
	meta: {
		isSerialize: true,
	},
	data:data
  });
};

//获取所有店铺名称
export const getStoreAll = () => {
  return request({
    url: "/base/store/storeList",
    method: "post"
  });
};
//支付渠道
// export const getAllChanelMapList = () => {
//   return request({
//     url: "/base/payChannel/getAllChanelMapList",
//     method: "post"
//   });
// };
//可见区域树
export const listTreeByUserOrganization = () => {
  return request({
    url: "/base/organization/listTreeByUserOrganization",
    method: "post"
  });
};